package com.hnichr.ping.tenant.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnichr.ping.tenant.entity.TenantBizType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface TenantBizTypeMapper extends BaseMapper<TenantBizType> {
    @Update("update T_TENANT_BIZ_TYPE set quantity=quantity-#{smsCount} where quantity-#{smsCount}>=0 and id=#{id}")
    int reduceSmsQuantity(@Param("smsCount") Integer smsCount,@Param("id") Long id);

    @Update("update T_TENANT_BIZ_TYPE set quantity=quantity+#{smsCount} where id=#{id}")
    int recoverSmsQuantity(@Param("smsCount") Integer smsCount,@Param("id") Long id);
}
